package com.jh.paymentchannel.pojo.enums;

import org.apache.commons.lang3.StringUtils;

public enum CmPayType {
    WEIXIN("weixin", "微信"),
    ALIPAY("alipay", "支付宝")
    ;
    private String value;
    private String desc;
    CmPayType(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public String getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    public static <T extends String> CmPayType of(T n) {
        String val;
        if (StringUtils.isEmpty(n)) {
            return null;
        }

        val = n;
        for (CmPayType payType : values()) {
            if (payType.getValue().equals(val)) {
                return payType;
            }
        }
        return null;
    }
}
